﻿using UnityEngine;

namespace Gp.Scripts.GameLogic {
    public class DynamicObjectController : TransDynamicObject {
        [SerializeField] private bool savePosition = true;


        protected override void OnInit() {
            var saveData = Model.GetInfoData(SaveKey);
            if (saveData == null) return;
            gameObject.SetActive(saveData.isActive);
            
            if (!savePosition) return;
            transform.position = saveData.trans.position;
            transform.rotation = saveData.trans.rotation;
        }
    }
}